<!DOCTYPE html>
<html>
<head>
    <title>用户中心</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <meta charset="utf-8" />
    <meta content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="Css/style.css" rel="stylesheet" type="text/css">
    <link href="Css/basic.css" rel="stylesheet" type="text/css">
    <link href="Css/usercenter.css" rel="stylesheet" type="text/css">
    <script src="Scripts/http.js"></script>
    <script type="text/javascript" src="Scripts/jquery-1.8.3.min.js"></script>
    <link rel="stylesheet" href="Css/common.css">
    <script type="text/javascript" src="Scripts/alertPopShow.js"></script>
    <script>
        /* 用途: 接收地直栏参数 取id=1 根据ID的值 */
        var newsid = geturlcanshu();
        $(function(){
            getorderinfo();
            function getorderinfo(){
                $.ajax({
                    url: url + 'getOrdersdetails',
                    dataType: 'json',
                    type: 'post',
                    async: false,
                    data: {id:newsid},
                    success: function (result) {
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        if (status == 1 && code == '1001') {
                            var orders = result.data;
                            var html = '';
                            var orderid = orders['weixinorders'];
                            var content = orders['content'];
                            var address = orders['address'];
                            var status = orders['status'];
                            var price = orders['price'];
                            $('#orderid').html(orderid);
                            $('#ordercontent').html(content);
                            $('#orderaddress').html(address);
                            $('#orderprice').html(price);
                            $('#ids').html(orders['id']);
                            $('#pingjia').val(result.pinglun);
                            if(status==1){
                                $('#orderstatus').html('订单未支付');
                                //$('#action').css('display','block');
                               $('#cancel').css('display','block');
                            }else if(status==2){
                                $('#orderstatus').html('订单已经支付，未完成');
                                $('#over').css('display','block');
                            }else if(status==3){
                                $('#orderstatus').html('订单完成未评价');
                                $('.pingjia').css('display','block');
                                $('#tijiao').css('display','block');
                            }else if(status==4){
                                $('#orderstatus').html('订单已经评价');
                                //$('.pingjia').css('display','none');
                                $('#tijiao').css('display','none');
                            }else if(status==5){
                                $('#orderstatus').html('订单完成');
                            }

                        }
                    },
                    error: function (result) {
                        console.log("error")
                    }
                });
            }


            $('#tijiao').click(function(){
                var orderid = $('#orderid').html();
                var pingjia = $('#pingjia').val();
                if(pingjia==''){
                      alert('必须填写评价内容');
                    return;
                }
                $.ajax({
                    url: url + 'comment',
                    dataType: 'json',
                    type: 'post',
                    async: false,
                    data: {orderid:orderid,content:pingjia},
                    success: function (result) {
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        if (status == 1 && code == '1001') {
                            alert('评价成功！');
                            $('#pingjia').val(pingjia);
                            $('#tijiao').css('display','none');
                            window.history.back();
                        }
                    },
                    error: function (result) {
                        console.log("error")
                    }
                });
            })
            $('#over').click(function(){
                var orderid = $('#orderid').html();
                $.ajax({
                    url: url + 'orderComplete',
                    dataType: 'json',
                    type: 'post',
                    async: false,
                    data: {orderid:orderid},
                    success: function (result) {
                        // console.log(result);
                        var status = result.status;
                        var code = result.code;
                        if (status == 1 && code == '1001') {
                            window.history.back();
                        }
                    },
                    error: function (result) {
                        console.log("error")
                    }
                });
            })
            $('#cancel').click(function(){
                var orderid = $('#orderid').html();
              //alert(orderid);
                $.ajax({
                    url: url + 'orderCancel',
                    dataType: 'json',
                    type: 'post',
                    async: false,
                    data: {orderid:orderid},
                    success: function (result) {
                        // console.log(result);
                      //alert('1111');
                        var status = result.status;
                        var code = result.code;
                        if (status == 1 && code == '1001') {
                            window.history.back();
                        }
                    },
                    error: function (result) {
                      alert('error');
                        console.log("error")
                    }
                });
            })
        })
    </script>
</head>
<body>

<div class="yintai-header">
    <a href="javascript:void(0);" class="back-button"></a>
    <div class="hear-name">用户订单详细</div>
    <div class="xiala"><span></span></div>
</div>

<div class="viewport">
    <input type="text" style="display: none" value="" id="ids">
    <div class="user-common user-phone" style="margin-top: 10px;">
        <a class="yintai-phone" href="javascript:void(0);">订单号：<div class="infor-phone"><span id="orderid">148766330220171110144442</span></div></a>
    </div>
    <div class="user-common user-phone" style="margin-top: 10px;height: 200px;">
        <span style="color:#666;padding:15px; ">订单内容：</span><div id="ordercontent">三大发送大方萨芬是到发送发送发送阿斯蒂芬撒旦法是否达到发送斯蒂芬斯蒂芬森</div>
    </div>
    <div class="user-common user-phone" style="margin-top: 10px;height: 200px;">
        <span style="color:#666;padding:15px; ">订单提货点：</span><div  id="orderaddress">三大发送大方萨芬是到发送发送发送阿斯蒂芬撒旦法是否达到发送斯蒂芬斯蒂芬森三大发送大方萨芬是到发送发送发送阿斯蒂芬撒旦法是否达到发送斯蒂芬斯蒂芬森</div>
    </div>
    <div class="user-common user-phone" style="margin-top: 10px;">
        <a class="yintai-phone" href="javascript:void(0);">订单状态：<div class="infor-phone"><span  id="orderstatus">阿萨德发</span></div></a>
    </div>
    <div class="user-common user-phone" style="margin-top: 10px;">
        <a class="yintai-phone" href="javascript:void(0);">订单金额：<div class="infor-phone"><span  id="orderprice">100</span>元</div></a>
    </div>
    <div class="user-common user-phone pingjia1" style="margin-top: 10px;" style="display:none">
        <a class="yintai-phone" href="javascript:void(0);">对订单评价：<div class="infor-phone"><input type="text" id="pingjia" placeholder="请填入评价内容(订单未完成前不好评价)" ></br></div></a>
    </div>
    <div class="user-common user-phone">
        <a class="yintai-phone" href="javascript:void(0);">操作：<div class="infor-phone" ><input type="button" id="action" class="button" value="支付" style="display: none"><input type="button" id="tijiao"  class="button" value="评论" style="display: none"><input type="button" id="over"  class="button" value="订单完成" style="display: none"><input type="button" id="cancel"  class="button" value="取消订单" style="display: none"></div></a>
    </div>
</div>
</body>
</html>
